import request from "../utils/request";
import { JoinType } from "../types/job.d";
export const jobGet = (page: number = 0) => {
  let skip = page * 20;
  return request.get("classes/VueJob", {
    params: {
      limit: 20,
      skip,
    },
  });
};

//加载分类
export const categoryGet = () => {
  return request.get("classes/VueCategory", {
    params: {
      where: {
        parentId: "0-0",
      },
    },
  });
};

//加载详情数据
export const jobDetailGet = (id: string) => {
  return request.get(`classes/VueJob/${id}`);
};

//岗位申请
export const joinPost = (joinData: Omit<JoinType, "objectId">) => {
  return request.post(`classes/VueJoin`, joinData);
};

//岗位报名状态确认
export const joinCheck = (userId: string, jobId: string) => {
  return request.get(`classes/VueJoin`, {
    params: {
      where: {
        userId,
        jobId,
      },
    },
  });
};
